/**
 * Created with IntelliJ IDEA.
 * User: zzl
 * Date: 12-12-1
 * To change this template use File | Settings | File Templates.
 */
(function ($) {

    var NumberInput = function (input) {
        this.$input = $(input);
        this.setup();
    };

    var proto = { constructor: NumberInput };
    NumberInput.prototype = proto;

    proto.setup = function () {
        var me = this;

        me.$input.on('keypress', function (e) {
            return me.input_keypress(e);
        });
    };

    proto.input_keypress = function (e) {
        var me = this;
        var charCode = (e.which) ? e.which : e.keyCode;
        if (charCode > 31 && (charCode < 48 || charCode > 57)) {
            return false;
        }
    };

    $.fn.numberInput = $.addPluginFn('numberInput', NumberInput);

})(jQuery);